<template>
  <div >
    <p>默认初始值是{{show}}，所以是显示的</p>
    <button @click.stop="closeDiv">关闭</button>
    <button @click.stop="closeDiv3">切换状态</button>
  </div>
</template>

<script>
 export default {
    name: "myComponent",
    props: ['show'],  
    data () {
        return {

        }
   },
   methods: {
     closeDiv() {
        this.$emit("update:show", false)
      },
      closeDiv3(){
        this.$emit("update:show", true)
      }
   }
 }
</script>

<style scoped>

 
</style>
